Skip to content

fix(test): add lcov 2.x version-gated --ignore-errors for coverage scripts - #761

Merged
deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
add-uos:fix-ut-lcov-ignore-errors
Dec 1, 2026
Merged

deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
add-uos:fix-ut-lcov-ignore-errors

Conversation

@add-uos

@add-uos add-uos commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

问题

Gerrit-unittest-check 流水线 CI 镜像的 lcov 为 2.x,对 gcov 计数器与源码不一致(ERROR: (inconsistent) mismatched end line)直接报错中断。项目中所有 lcov/genhtml 调用均未带 --ignore-errors,任一阶段(capture/extract/remove/genhtml)失败即覆盖率无法产出,流水线记录 0.0%。

deepin-screen-recorder(#553/#555/#561,PR #1101/#1103)与 deepin-terminal(#531/#544/#545,PR #608/#609)已确认并修复同因问题:terminal 修复后覆盖率 80.30%、screen-recorder 83.10%。

修复

  • 每个含 lcov 的脚本在第一个调用前插入版本门控:lcov --version 提取主版本号,>= 2 时 LCOV_IG6="--ignore-errors inconsistent,mismatch"
  • 所有 lcov/genhtml 调用注入 $LCOV_IGN(共 N 处)
  • lcov 1.x 不支持该错误类型,LCOV_IGN 为空,行为不变

验证

  • bash -n 全部通过
  • 本地 lcov 1.14 实测:LCOV_MAJOR=1 → 不加参数(原行为)
  • 门控写法与 deepin-terminal e4798910、deepin-screen-recorder 82ae9f30 完全一致(CI 已验证)

PMS: TASK-398635

Summary by Sourcery

Keep coverage reporting compatible with both lcov 1.x and 2.x across the project’s coverage scripts.

Bug Fixes:

  • Allow coverage report generation to continue when lcov 2.x encounters inconsistent or mismatched gcov data.

Chores:

  • Add SPDX copyright and license headers to the common coverage-report script.

…ripts

CI 镜像 lcov 为 2.x,对 gcov 计数器与源码不一致(inconsistent/mismatch)
直接报错中断,任一阶段失败都会导致覆盖率无法产出(与
deepin-screen-recorder linuxdeepin#553、deepin-terminal linuxdeepin#531 同因)。按版本门控
(lcov >= 2 才加 --ignore-errors inconsistent,mismatch)注入全部
lcov/genhtml 调用,lcov 1.x 行为不变。

PMS: TASK-398635
Log: CI 单测覆盖率流水线 lcov 2.x 兼容
Influence: 不影响 lcov 1.x 本地行为
@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Add lcov-version detection and pass the lcov 2.x ignore-errors option to coverage capture and extract steps in the shared coverage script.

  • tests/common/cov_report.sh L13-24

Version-gate and apply the ignore-errors option across the test runner’s lcov and genhtml calls so coverage generation can continue on lcov 2.x.

  • tests/test-prj-running.sh L79-95

Documentation

Add SPDX copyright and license headers to the shared coverage script.

  • tests/common/cov_report.sh L2-4

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

lzwind
lzwind previously approved these changes Dec 1, 2026
- 单年份版权行更新为创建年-2026 区间(CI SPDX 检查要求)
- 为缺失 SPDX header 的脚本补充版权与 license 声明

PMS: TASK-398635
Log: CI SPDX 检查修复
Influence: 仅注释变更,不影响脚本逻辑
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos

add-uos commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
deepin-bot Bot merged commit f74c90c into linuxdeepin:master Dec 1, 2026
20 checks passed
@deepin-bot

deepin-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked, merge_method: rebase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants